<template>
    <div class="Child">
        <h2>子组件1</h2>
        <h3>玩具：{{ toy }}</h3>
        <button @click="emitter.emit('send-toy',toy)">把玩具给子组件2</button> <!-- 点击按钮触发事件 -->
    </div>
</template>

<script lang="ts" setup name="Child1">
    import {ref} from "vue"
    import emitter from "@/utils/emitter"
    //数据
    let toy = ref("奥特曼")
</script>

<style scoped>
.Child{
    background-color: orange;
    width: 1000px;
    height: 200px;
}
</style>